package de.jonasjelten.jcalc.parser;

import de.jonasjelten.jcalc.exception.JExpressionParserException;
import de.jonasjelten.jcalc.exception.JParserException;
import de.jonasjelten.jcalc.mathExps.JMathExp;
import de.jonasjelten.jcalc.mathExps.JPi;
import java.util.Arrays;
import java.util.List;

/**
 *
 * @author JJ
 */
public class JPiParser extends JExpressionParser {

    @Override
    public JMathExp parseExpression(String[] functionargument) throws JParserException {
        try {
            return new JPi(Integer.parseInt(functionargument[0]), parser.jCalc);
        } catch (IllegalArgumentException e) {
            throw new JExpressionParserException("Pi function argument not a full number.");
        }

    }

    @Override
    public List<String> getExpressionAliases() {
        return Arrays.asList(new String[] {"pi"});
    }
}
